From c4c030cc79728820eee6cd19d58f9826a0eab734 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Thu, 25 Aug 2016 12:14:21 -0400 Subject: [PATCH] libtest: add has_gpgme() helper function Closes: #469 Approved by: cgwalters --- tests/libtest.sh | 4 ++++ tests/test-commit-sign.sh | 6 +++--- tests/test-gpg-signed-commit.sh | 6 +++--- tests/test-pull-mirror-summary.sh | 2 +- tests/test-pull-summary-sigs.sh | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/libtest.sh b/tests/libtest.sh index 958f6769..bc114bfa 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -420,6 +420,10 @@ skip_without_fuse () { [ -e /etc/mtab ] || skip "no /etc/mtab" } +has_gpgme () { + ${CMD_PREFIX} ostree --version | grep -q -e '\+gpgme' +} + libtest_cleanup_gpg () { gpg-connect-agent --homedir ${test_tmpdir}/gpghome killagent /bye || true } diff --git a/tests/test-commit-sign.sh b/tests/test-commit-sign.sh index e469c0f9..01eb45f8 100755 --- a/tests/test-commit-sign.sh +++ b/tests/test-commit-sign.sh @@ -19,13 +19,13 @@ set -euo pipefail -if ! ostree --version | grep -q -e '\+gpgme'; then +. $(dirname $0)/libtest.sh + +if ! has_gpgme; then echo "1..0 #SKIP no gpg support compiled in" exit 0 fi -. $(dirname $0)/libtest.sh - echo "1..1" keyid="472CDAFA" diff --git a/tests/test-gpg-signed-commit.sh b/tests/test-gpg-signed-commit.sh index fa42d677..ad022b2b 100755 --- a/tests/test-gpg-signed-commit.sh +++ b/tests/test-gpg-signed-commit.sh @@ -20,13 +20,13 @@ set -euo pipefail -if ! ostree --version | grep -q -e '\+gpgme'; then +. $(dirname $0)/libtest.sh + +if ! has_gpgme; then echo "1..0 #SKIP no gpgme support compiled in" exit 0 fi -. $(dirname $0)/libtest.sh - echo "1..1" setup_test_repository "archive-z2" diff --git a/tests/test-pull-mirror-summary.sh b/tests/test-pull-mirror-summary.sh index 49aa91ad..1ef6a09c 100755 --- a/tests/test-pull-mirror-summary.sh +++ b/tests/test-pull-mirror-summary.sh @@ -61,7 +61,7 @@ find repo/objects -name '*.filez' | while read name; do done echo "ok pull mirror summary" -if ! ${CMD_PREFIX} ostree --version | grep -q -e '\+gpgme'; then +if ! has_gpgme; then exit 0; fi diff --git a/tests/test-pull-summary-sigs.sh b/tests/test-pull-summary-sigs.sh index 65822d23..2dcfbd65 100755 --- a/tests/test-pull-summary-sigs.sh +++ b/tests/test-pull-summary-sigs.sh @@ -54,7 +54,7 @@ assert_file_has_content yet-another-copy/yet-another-hello-world "hello world ye ${CMD_PREFIX} ostree --repo=repo fsck echo "ok pull mirror summary" -if ! ${CMD_PREFIX} ostree --version | grep -q -e '\+gpgme'; then +if ! has_gpgme; then exit 0; fi -- 2.30.2